package com.kingyun.gpsinspection.purificationservice.facade.service.tdm;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.EmployeeVo;
import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.RedisValue;
import com.kingyun.gpsinspection.purificationservice.facade.model.tdm.Task;
import com.kingyun.gpsinspection.purificationservice.facade.model.tdm.WorkOrder;

import java.util.List;
import java.util.Map;

/**
 * Created by sugongche on 2016/12/19.
 */
public interface TaskService {

    /**
     * 根据任务ID查询十大任务
     *
     * @param taskId
     * @return
     */
    Task findTaskByTaskId(String taskId) throws Exception;

    /**
     * 构造任务列表所需数据结构
     *
     * @param employeeVo
     * @param task
     * @return
     * @throws Exception
     */
    Map<String, Object> listMap(EmployeeVo employeeVo, Task task) throws Exception;

    /**
     * 异步请求与我相关的table数据：当前人发起或者当前人审核的任务
     *
     * @param employeeVo
     * @param task
     * @return
     */
    Map<String, Object> listRelatedTaskMap(EmployeeVo employeeVo, Task task) throws Exception;

    /**
     * 异步请求子任务的table数据
     *
     * @param employeeVo
     * @param task
     * @return
     * @throws Exception
     */
    Map<String, Object> listChildTaskMap(EmployeeVo employeeVo, Task task) throws Exception;

    /**
     * 构造四大任务列表所需数据结构
     *
     * @param employeeVo
     * @param task
     * @return
     * @throws Exception
     */
    Map<String, Object> fourListMap(EmployeeVo employeeVo, Task task) throws Exception;

    /**
     * 构造分析处理任务列表所需数据结构
     *
     * @param employeeVo
     * @param task
     * @return
     * @throws Exception
     */
    Map<String, Object> fxclListMap(EmployeeVo employeeVo, Task task) throws Exception;

    /**
     * 构造危害因素辨识任务列表所需数据结构
     *
     * @param employeeVo
     * @param task
     * @return
     * @throws Exception
     */
    Map<String, Object> whysbsListMap(EmployeeVo employeeVo, Task task) throws Exception;

    /**
     * 列表展示代办任务(旧方法)
     */
    JSONObject listToDoTask(RedisValue redisValue, Task task) throws Exception;

    /**
     * 列表展示代办任务
     *
     * @param redisValue
     * @param task
     * @return
     * @throws Exception
     */
    JSONObject listToDoTaskMap(RedisValue redisValue, Task task) throws Exception;

    /**
     * 保存自主任务
     *
     * @param task
     * @return
     */
    String saveAutonomicTask(Task task, WorkOrder workOrder);

    /**
     * 终止任务
     *
     * @param employee
     * @param list
     * @return
     */
    int closeTaskByFlowIds(EmployeeVo employee, List<String> list);


    /**
     * 终止任务
     *
     * @param employee
     * @param list
     * @return
     */
    int closeTaskByTaskIds(EmployeeVo employee, List<String> list);

    /**
     * 获取任务类型的饼图data
     *
     * @param employeeVo
     * @return
     */
    String queryTaskTypePieChartData(EmployeeVo employeeVo);

    /**
     * 获取任务状态的饼图data
     *
     * @param employeeVo
     * @return
     */
    String queryTaskStatusPieChartData(EmployeeVo employeeVo);

    /**
     * 获得当前处置人
     *
     * @param employeeVo
     * @param piPiid
     * @return
     */
    String queryCurrentDisposeName(EmployeeVo employeeVo, String piPiid);

    /**
     * 查询待办任务总条数
     *
     * @param redisValue redis信息
     */
    JSONArray queryToDoTaskCount(RedisValue redisValue) throws Exception;

    /**
     * 根据主任务ID，查询关联任务
     *
     * @param masterTaskId
     * @return
     */
    List<Task> findRelatedTasksByMasterTaskId(String masterTaskId);

    /**
     * 根据业务id查询流程的id
     *
     * @param BusinessId 业务id
     */
    String getTaskIdByBusinessId(String BusinessId);
}
